//
//  WHNetworkManager.h
//  LvZhongMagicKey
//
//  Created by 邓伟浩 on 2017/12/16.
//  Copyright © 2017年 邓伟浩. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

typedef void (^NetworkStatusBlock)(BOOL isHaveNetwork, AFNetworkReachabilityStatus status);
typedef void (^completionBlock)(id responseObject);

@interface WHNetworkManager : NSObject

/** 文件下载 */
+ (NSURLSessionDownloadTask *)downLoadWithUrl:(NSString *)urlString
               fileName:(NSString *)fileName
              progress:(void (^)(double progress))progress
               Success:(void (^)(id responseObject))success
                  failure:(void (^)(NSError *error))failure;

+ (NSURLSessionDataTask *)upLoadFileWithUrlStr:(NSString *)urlStr
                                    parameters:(id)parameters
                                      fileName:(NSString *)fileName
                                      filePath:(NSString *)filePath
                                          name:(NSString *)name
                                       Success:(void (^)(id responseObject))success
                                       failure:(void (^)(NSError *error))failure;


/** 图片上传 */
+ (NSURLSessionDataTask *)upLoadImageWithUrlStr:(NSString *)urlStr parameters:(id)parameters imageData:(NSData *)imageData fileName:(NSString *)fileName name:(NSString *)name Success:(void (^)(id responseObject))success failure:(void (^)(NSError *error))failure;

// 请求url数据
+ (NSURLSessionDataTask *)requestWithURL:(NSString *)urlStr parameters:(id)parameters isUpData:(BOOL)is Success:(void (^)(id responseObject))success failure:(void (^)(NSError *error))failure;

+ (NSURLSessionDataTask *)requestWithURL:(NSString *)urlStr
                              parameters:(id)parameters
                                 Success:(void (^)(id responseObject))success
                                 failure:(void (^)(NSError *error))failure;

+ (void)cancelAllRequest;

+ (void)checkNetworkAvailable:(NetworkStatusBlock)showNetworkStatus;


@end
